package com.hyw.cm.protocal.driver.xiaoan;

import java.time.Duration;

import com.hyw.cm.common.protocal.spi.IDecoder;
import com.hyw.cm.common.protocal.spi.IEncoder;
import com.hyw.cm.common.protocal.spi.IProtocalDriver;

import io.netty.handler.codec.ByteToMessageDecoder;

/**
 * 小安科技协议驱动
 * <p>
 * 协议详情参照：
 * <li>上行：{@link http://res.xiaoantech.com/protocol/sharing/XiaoanTechNetWorkProtocol(BIN)_latest.html#truecmd_gps_v4%E7%8A%B6%E6%80%81%E4%B8%8A%E6%8A%A5cmd41}
 * <li>下行：{@link https://res.xiaoantech.com/protocol/sharing/XiaoanTechNetWorkProtocol(JSON)_latest.html#true%E4%BF%AE%E6%94%B9%E6%9C%8D%E5%8A%A1%E5%99%A8%E5%9C%B0%E5%9D%80cmd11}
 * 
 * @author Hongyu
 */
public class XiaoAnProtocalDriver implements IProtocalDriver {
  // 协议中，心跳包是600秒，则服务端允许为900秒
  private static final Duration HEARTBEAT_INTERVAL = Duration.ofSeconds(900);

  private final XiaoAnDecoder decoder = new XiaoAnDecoder();

  @Override
  public Duration getReadTimeout() {
    return HEARTBEAT_INTERVAL;
  }

  @Override
  public IDecoder<ByteToMessageDecoder> getDecoder() {
    return decoder;
  }

  @Override
  public IEncoder getEncoder() {
    // TODO Auto-generated method stub
    return null;
  }

}
